package com.wuhao.shootclient.bean;

import com.wuhao.shootclient.util.Ardith;
import com.wuhao.shootclient.util.RectInfo;

import java.util.List;

public class ResultsBean {


    private PaperBean paper;
    private List<AllPointsBean> all_points;

    public PaperBean getPaper() {
        return paper;
    }

    public void setPaper(PaperBean paper) {
        this.paper = paper;
    }

    public List<AllPointsBean> getAll_points() {
        return all_points;
    }

    public void setAll_points(List<AllPointsBean> all_points) {
        this.all_points = all_points;
    }

    public static class PaperBean {
        /**
         * create_at : 2020年08月04日 11时28分50秒
         * update_at : 2020年08月04日 11时28分50秒
         * id : 634
         * position_number : 1
         * centreX : 386
         * centreY : 520
         * centreW : 152
         * centreH : 151
         * imageW : 768
         * imageH : 909
         * cut_path : C:\shoot-data\image/2020-08-11/192.168.0.214/cut//214-19-24-15_0813.jpg
         */

        private String create_at;
        private String update_at;
        private int id;
        private int position_number;
        private int centreX;
        private int centreY;
        private int centreW;
        private int centreH;
        private int imageW;
        private int imageH;
        private String cut_path;

        public String getCreate_at() {
            return create_at;
        }

        public void setCreate_at(String create_at) {
            this.create_at = create_at;
        }

        public String getUpdate_at() {
            return update_at;
        }

        public void setUpdate_at(String update_at) {
            this.update_at = update_at;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public int getPosition_number() {
            return position_number;
        }

        public void setPosition_number(int position_number) {
            this.position_number = position_number;
        }

        public int getCentreX() {
            return centreX;
        }

        public void setCentreX(int centreX) {
            this.centreX = centreX;
        }

        public int getCentreY() {
            return centreY;
        }

        public void setCentreY(int centreY) {
            this.centreY = centreY;
        }

        public int getCentreW() {
            return centreW;
        }

        public void setCentreW(int centreW) {
            this.centreW = centreW;
        }

        public int getCentreH() {
            return centreH;
        }

        public void setCentreH(int centreH) {
            this.centreH = centreH;
        }

        public int getImageW() {
            return imageW;
        }

        public void setImageW(int imageW) {
            this.imageW = imageW;
        }

        public int getImageH() {
            return imageH;
        }

        public void setImageH(int imageH) {
            this.imageH = imageH;
        }

        public String getCut_path() {
            return cut_path;
        }

        public void setCut_path(String cut_path) {
            this.cut_path = cut_path;
        }
    }


    public static class AllPointsBean {
        /**
         * create_at : 2020年08月11日 11时24分41秒
         * update_at : 2020年08月11日 11时24分41秒
         * centreXProportion : 0.5
         * centreYProportion : 0.5965
         * tenRadiuProportion : 0.197
         * id : 7146
         * position_number : 1
         * paper_id : 634
         * people_id : 146
         * group_id : 436
         * race_id : 1
         * score : 10.09
         * orientation : 正左偏下
         * x1 : 298.634765625
         * y1 : 522.0797751075
         * x2 : 333.9416246916
         * y2 : 562.335224503
         * image_path : C:\shoot-data\image/2020-08-11/192.168.0.214/capture//214-19-24-15_0813.jpg
         * cut_path : C:\shoot-data\image/2020-08-11/192.168.0.214/cut//214-19-24-15_0813.jpg
         * angel : 197
         * centre_width : 152
         * centre_height : 151
         * cut_width : 768
         * cut_height : 909
         * centreX : 386
         * centreY : 520
         * is_valid : 0
         * silhouette_type : Silhouette
         * bullet_num : 0
         * total_score : 0
         */

        private String create_at;
        private String update_at;
        private double centreXProportion;
        private double centreYProportion;
        private double tenRadiuProportion;
        private int id;
        private int position_number;
        private int paper_id;
        private int people_id;
        private int group_id;
        private int race_id;
        private Float score;
        private String orientation;
        private Double x1;
        private Double y1;
        private Double x2;
        private Double y2;
        private String image_path;
        private String cut_path;
        private Integer angel;
        //十环宽高
        private Double centre_width;
        private Double centre_height;
        //截图宽高
        private Integer cut_width;
        private Integer cut_height;
        //十环中心坐标
        private Double centreX;
        private Double centreY;
        private int is_valid;
        private Object silhouette_type;
        private int bullet_num;
        private int total_score;
        private String target_type;

        public String getTarget_type() {
            return target_type;
        }

        public void setTarget_type(String target_type) {
            this.target_type = target_type;
        }

        /**
         * 按照请求的宽高以中心点为坐标返回弹孔坐标
         * @param clientW  宽
         * @param clientH 高
         * @param paper 纸
         * @return PointI
         */
        public ShootFireVo getCenter(Integer cut_width,Integer cut_height,int clientW, int clientH,
                                     ResultsBean.AllPointsBean paper, double tenWidthRadiuProportion ,
                                     double tenHeightRadiuProportion,String target_type) {

            ShootFireVo center = new ShootFireVo();
             if ((x1 != null || y1 != null) && paper != null && paper.getCentre_width() != null && paper.getCentre_height() != null) {
                //脱把的情况下坐标都是null
                //客户端十环宽高
                double radiusX = Ardith.mul(clientW, tenWidthRadiuProportion);
                double radiusY = Ardith.mul(clientH, tenHeightRadiuProportion);
                //十环宽高和服务器图片宽高除法算比例
                radiusX = Ardith.div(radiusX, paper.getCentre_width());
                radiusY = Ardith.div(radiusY, paper.getCentre_height());
                //算坐标位置
                center = RectInfo.create(this.x1, this.y1, this.x2, this.y2).getCenter();
                //转换为中心点在10环坐标系的位置
                //double i = center.getX() - paper.getCentreX();
                //double n = center.getY() - paper.getCentreY();
                //乘法计算弹孔在客户端的位置
                //enter.setX((int) Ardith.mul(i, radiusX));
                //center.setY((int) Ardith.mul(n, radiusY));
                 center.setX(x1.intValue());
                 center.setY(y1.intValue());
            } else {
                center = new ShootFireVo();
//                center.setX(clientW);
//                center.setY(clientH);
                 center.setX(x1.intValue());
                 center.setY(y1.intValue());
            }
///Users/kunl/Desktop/img/image/2020-08-27/192.168.0.210/cut//210-18-06-07_9058.jpg
            if (cut_path != null) {
                if (cut_path.toString().indexOf("image") == -1){
//                    center.setImage(cut_path.toString().substring(cut_path.toString().indexOf("img")).trim());
                }
                else {
                    center.setImage(cut_path.toString().substring(cut_path.toString().indexOf("image")).trim());
                }
            } else {
                center.setImage("");
            }
            if (angel == null){
                center.setAngel(0);
            }
            else {
                center.setAngel(angel);
            }
            if (score == null){
                center.setScore(0.0f);
            }
            else {
                center.setScore(score);
            }
            center.setOrientation(orientation);
            center.setTarget_type(target_type);
//        center.setCreate_at(create_at);
            return center;
        }


        public String getCreate_at() {
            return create_at;
        }

        public void setCreate_at(String create_at) {
            this.create_at = create_at;
        }

        public String getUpdate_at() {
            return update_at;
        }

        public void setUpdate_at(String update_at) {
            this.update_at = update_at;
        }

        public double getCentreXProportion() {
            return centreXProportion;
        }

        public void setCentreXProportion(double centreXProportion) {
            this.centreXProportion = centreXProportion;
        }

        public double getCentreYProportion() {
            return centreYProportion;
        }

        public void setCentreYProportion(double centreYProportion) {
            this.centreYProportion = centreYProportion;
        }

        public double getTenRadiuProportion() {
            return tenRadiuProportion;
        }

        public void setTenRadiuProportion(double tenRadiuProportion) {
            this.tenRadiuProportion = tenRadiuProportion;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public int getPosition_number() {
            return position_number;
        }

        public void setPosition_number(int position_number) {
            this.position_number = position_number;
        }

        public int getPaper_id() {
            return paper_id;
        }

        public void setPaper_id(int paper_id) {
            this.paper_id = paper_id;
        }

        public int getPeople_id() {
            return people_id;
        }

        public void setPeople_id(int people_id) {
            this.people_id = people_id;
        }

        public int getGroup_id() {
            return group_id;
        }

        public void setGroup_id(int group_id) {
            this.group_id = group_id;
        }

        public int getRace_id() {
            return race_id;
        }

        public void setRace_id(int race_id) {
            this.race_id = race_id;
        }

        public Float getScore() {
            return score;
        }

        public void setScore(Float score) {
            this.score = score;
        }

        public String getOrientation() {
            return orientation;
        }

        public void setOrientation(String orientation) {
            this.orientation = orientation;
        }

        public Double getX1() {
            return x1;
        }

        public void setX1(Double x1) {
            this.x1 = x1;
        }

        public Double getY1() {
            return y1;
        }

        public void setY1(Double y1) {
            this.y1 = y1;
        }

        public Double getX2() {
            return x2;
        }

        public void setX2(Double x2) {
            this.x2 = x2;
        }

        public Double getY2() {
            return y2;
        }

        public void setY2(Double y2) {
            this.y2 = y2;
        }

        public String getImage_path() {
            return image_path;
        }

        public void setImage_path(String image_path) {
            this.image_path = image_path;
        }

        public String getCut_path() {
            return cut_path;
        }

        public void setCut_path(String cut_path) {
            this.cut_path = cut_path;
        }

        public Integer getAngel() {
            return angel;
        }

        public void setAngel(Integer angel) {
            this.angel = angel;
        }

        public Double getCentre_width() {
            return centre_width;
        }

        public void setCentre_width(Double centre_width) {
            this.centre_width = centre_width;
        }

        public Double getCentre_height() {
            return centre_height;
        }

        public void setCentre_height(Double centre_height) {
            this.centre_height = centre_height;
        }

        public Integer getCut_width() {
            return cut_width;
        }

        public void setCut_width(Integer cut_width) {
            this.cut_width = cut_width;
        }

        public Integer getCut_height() {
            return cut_height;
        }

        public void setCut_height(Integer cut_height) {
            this.cut_height = cut_height;
        }

        public Double getCentreX() {
            return centreX;
        }

        public void setCentreX(Double centreX) {
            this.centreX = centreX;
        }

        public Double getCentreY() {
            return centreY;
        }

        public void setCentreY(Double centreY) {
            this.centreY = centreY;
        }

        public int getIs_valid() {
            return is_valid;
        }

        public void setIs_valid(int is_valid) {
            this.is_valid = is_valid;
        }

        public Object getSilhouette_type() {
            return silhouette_type;
        }

        public void setSilhouette_type(Object silhouette_type) {
            this.silhouette_type = silhouette_type;
        }

        public int getBullet_num() {
            return bullet_num;
        }

        public void setBullet_num(int bullet_num) {
            this.bullet_num = bullet_num;
        }

        public int getTotal_score() {
            return total_score;
        }

        public void setTotal_score(int total_score) {
            this.total_score = total_score;
        }
    }


}
